home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
05
/
6
/
DISK0564.ZIP
/
SOURCE.ARC
/
UPDATE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-07-09
|
2KB
|
56 lines
/* this program sets the date and time of one or more files to the
current system date and time */
/* for MSDOS Version 2 or higher */
/* usage: update file1 file2 ... */
/* file name can be ambiguous */
/* for Aztec C86 v. 3.20e */
/* by Jon Dart, 29-Mar-1986 */
#include "stdio.h"
#include "fixpath.h"
#include "sgtty.h"
#include "ctype.h"
#include "truth.h"
#include "ascii.h"
#define PATHSIZE 128
extern char *malloc();
main(argc,argv)
int argc; char *argv[];
{
char *sp,*lip,*fn, *fn2;
int n,type,attrib;
sp = malloc(PATHSIZE);
lip = malloc(PATHSIZE);
fn = malloc(PATHSIZE);
fn2 = malloc(PATHSIZE);
if (argc<=1) {
fprintf(stderr,"Update -- sets the date and time of one or more\n");
fprintf(stderr," files to the current date and time.\n\n");
fprintf(stderr,"by Jon Dart ... Version 1.0 (29-Mar-86)\n\n");
fprintf(stderr,"Usage:\n update file1 file2 ....\n");
fprintf(stderr," (file names can be ambiguous)\n");
exit(1);
}
for (n=1;n<argc;n++) {
type = fixpath(argv[n],sp,lip);
if (getfirst(sp,0x21,fn,&attrib)) {
strcpy(fn2,lip);
strcat(fn2,fn);
utime(fn2,0); /* update time for 1 file */
while (getnext(fn,&attrib)) {
strcpy(fn2,lip);
strcat(fn2,fn);
utime(fn2,0);
}
}
else {
fprintf(stderr,"%s%s\n","Error - can't find: ",argv[n]);
}
}
}